package com.sunqizhong.service.impl;

import com.sunqizhong.entity.EmpLog;
import com.sunqizhong.mapper.EmpLogMapper;
import com.sunqizhong.service.EmpLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
public class EmpLogServiceImpl implements EmpLogService {
    @Autowired
    private EmpLogMapper empLogMapper;


    /*
    * 插入操作日志
    * */
    //@Transactional(propagation = Propagation.REQUIRES) //开启事务，REQUIRED默认值，有则加入，无则创建
    @Transactional(propagation = Propagation.REQUIRES_NEW) //开启事务
    @Override
    public void insertLog(EmpLog empLog){
        empLogMapper.insert(empLog);
    }
}
